{include file="header.html"}
<div id="page_main" class="main-right">
  <div id="rightTop">
    <p>{$lang.order_manage}</p>
    <ul class="subnav">
      <li><span>{$lang.all_order}</span></li>
    </ul>
  </div>
  <div class="search-form clearfix">
    <form method="get" id="formSearch">
      <input type="hidden" name="r" value="order/index" />
      <select class="querySelect" name="field">
        
			{html_options options=$search_options selected=$smarty.get.field}
		
      </select>
      <input class="queryInput" type="text" name="search_name" value="{$smarty.get.search_name|escape}" />
      <select class="querySelect" name="status">
        <option value="">{$lang.search_status}</option>
        
            {html_options options=$order_status_list selected=$smarty.get.status} 
		
      </select>
      {$lang.add_time_from}
      <input class="queryInput" type="text" value="{$smarty.get.add_time_from}" id="add_time_from" name="add_time_from" class="pick_date" />
      {$lang.add_time_to}
      <input class="queryInput" type="text" value="{$smarty.get.add_time_to}" id="add_time_to" name="add_time_to" class="pick_date" />
      {$lang.order_amount_from}
      <input class="queryInput2" type="text" value="{$smarty.get.order_amount_from}" name="order_amount_from" />
      {$lang.order_amount_to}
      <input class="queryInput2" type="text" style="width:60px;" value="{$smarty.get.order_amount_to}" name="order_amount_to" class="pick_date" />
      <input type="submit" class="formbtn" value="{$lang.query}" />
      <!--{if $filtered}--> 
      <a class="formbtn formbtn1" href="{url route='order/index'}">{$lang.cancel_query}</a> 
      <!--{/if}-->
    </form>
  </div>
  <div id="flexigrid"></div>
</div>
<script type="text/javascript">
$(function(){
    $("#flexigrid").flexigrid({
		url: url(['order/index', $("#formSearch").serializeJson()]),
    	colModel : [
    		{ display: '{$lang.operation}', name : 'operation', width : 100, sortable : false, align: 'center', className: 'handle'},
		  	{ display: '{$lang.order_sn}', name : 'order_sn', width : 150, sortable : true, align: 'center'},
		  	{ display: '{$lang.store_name}', name : 'seller_name', width : 100, sortable : true, align: 'center'},
    		{ display: '{$lang.add_time}', name : 'add_time', width : 200, sortable : true, align: 'center'},
			  { display: '{$lang.buyer_name}', name : 'buyer_name', width : 100, sortable : true, align: 'center'},
    		{ display: '{$lang.order_amount}', name : 'order_amount', width : 80, sortable : true, align: 'center'},    		
			  { display: '{$lang.payment_name}', name : 'payment_name', width: 100, sortable : true, align : 'center'},
			  { display: '{$lang.status}', name : 'status', width: 100, sortable : true, align : 'center'}	,
      ],
		  buttons : [
        { display: '<i class="fa fa-file-excel-o"></i>{$lang.export_data}', name : 'csv', bclass : 'csv', title : '{$lang.export_data}', onpress : fg_operate }
      ],
      sortname: "add_time",
      sortorder: "desc",
      title: '{$lang.order_list}'
    });
	
	  $('#add_time_from').datepicker({ dateFormat: 'yy-mm-dd'});
    $('#add_time_to').datepicker({ dateFormat: 'yy-mm-dd'});
});
function fg_operate(name, bDiv) {
	var itemlist = new Array();
	$('.trSelected',bDiv).each(function(){
		itemlist.push($(this).attr('data-id'));
	});
	if(name == 'csv'){
		if($('.trSelected',bDiv).length == 0){
		   layer.confirm(lang.download_all_data,{ icon: 3, title:lang.notice}, function(index){
				fg_csv(itemlist, 'order');
				layer.close(index);
			},function(index){
				layer.close(index);
			});
	   }else{
		   fg_csv(itemlist, 'order');
	   }
	}
}
</script> 
{include file="footer.html"} 